gtkwidget: Add private set_pass_through() call
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 6 Apr 2017 11:55:35 +0000 (13:55 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 25 May 2017 14:25:59 +0000 (16:25 +0200)
We could eventually support pointer-event in CSS here, in the mean
time add this call to replace the GdkWindow API.

gtk/gtkwidget.c
gtk/gtkwidgetprivate.h

index 92845b21b9f255623f3161cde2a182630f8002eb..ce3e54f94ee606b2df380b096d030f603e9a3dd3 100644 (file)
@@ -989,7 +989,8 @@ gtk_widget_real_pick (GtkWidget *widget,
     {
       gdouble tx = x, ty = y;
 
-      if (!gtk_widget_is_sensitive (child) ||
+      if (gtk_widget_get_pass_through (child) ||
+          !gtk_widget_is_sensitive (child) ||
           !gtk_widget_is_drawable (child))
         continue;
 
@@ -15683,3 +15684,16 @@ gtk_widget_get_cursor (GtkWidget *widget)
 {
   return widget->priv->cursor;
 }
+
+void
+gtk_widget_set_pass_through (GtkWidget *widget,
+                             gboolean   pass_through)
+{
+  widget->priv->pass_through = !!pass_through;
+}
+
+gboolean
+gtk_widget_get_pass_through (GtkWidget *widget)
+{
+  return widget->priv->pass_through;
+}
index 422969a4d88a1c4830e0aed3a9d940633bddee45..8763278104f687c15910ce0ebbe21f8f17eccbf7 100644 (file)
@@ -70,6 +70,7 @@ struct _GtkWidgetPrivate
   guint child_visible         : 1;
   guint multidevice           : 1;
   guint has_shape_mask        : 1;
+  guint pass_through          : 1;
 
   /* Queue-resize related flags */
   guint resize_needed         : 1; /* queue_resize() has been called but no get_preferred_size() yet */
@@ -323,6 +324,9 @@ void              gtk_widget_set_cursor                    (GtkWidget *widget,
                                                             GdkCursor *cursor);
 GdkCursor *       gtk_widget_get_cursor                    (GtkWidget *widget);
 
+void              gtk_widget_set_pass_through              (GtkWidget *widget,
+                                                            gboolean   pass_through);
+gboolean          gtk_widget_get_pass_through              (GtkWidget *widget);
 
 /* inline getters */